<template>
  <div class="page-common-layout">
    <div class="page-common-content">
      <tool-bar @search="$refs.table.refresh(true)" @reset="
        () => {
          (this.queryParam = {}), $refs.table.refresh(true);
        }
      ">
        <template slot="toolBtn" slot-scope="scope">
          <a-button class="cu-btn-primary" icon="plus" @click="handleAdd()">{{ $ct("add", "新增") }}</a-button>
          <!--<a-button-->
          <!--class="cu-btn-danger"-->
          <!--icon="delete"-->
          <!--@click="handleSub($refs.masterList.selectedRowKeys)"-->
          <!--&gt;{{$ct("delete","删除")}}</a-button-->
          <!--&gt;-->
        </template>
        <template slot="toolForm">
          <a-form-item label="名称">
            <a-input v-model="queryParam.classificationName" placeholder="名称" style="width: 200px;" />
          </a-form-item>
          <a-form-item label="编码">
            <a-input v-model="queryParam.classificationCode" placeholder="编码" style="width: 200px;" />
          </a-form-item>
        </template>
      </tool-bar>
      <DataGrid ref="table" :columns="columns" :url="url" :queryParam="queryParam" rowKey="uuid" :showRowSelect="false">
        <span slot="renderAction" slot-scope="{ text, record, index }">
          <template>
            <a @click="handleEdit(record)">{{ $ct("edit", "编辑") }}</a>
            <span class="action-margin"></span>
            <a @click="handleSub(record)" class="action-delete">{{ $ct("delete", "删除") }}</a>
          </template>
        </span>
      </DataGrid>
      <!--	新增编辑	 -->
      <edit-form :type="key" ref="createModal" :visible="visible" :loading="confirmLoading" :model="mdl"
        @cancel="handleCancel()" @ok="handleOk()" />
    </div>
  </div>
</template>
<script>
import { DataGrid } from "@/components";
import { dataGridMixin } from "@/mixins/dataGridMixin";
import editForm from "./edit";
export default {
  name: "Table",
  components: { DataGrid, editForm },
  mixins: [dataGridMixin],
  data() {
    return {
      columns: [
        {
          title: "名称",
          align: "left",
          dataIndex: "classificationName",
          langCode: "classificationName2",
        },
        {
          title: "编码",
          dataIndex: "classificationCode",
          langCode: "classificationCode1",
        },
        {
          title: "排序",
          dataIndex: "classificationSort",
          align: "center",
          langCode: "sort",
        },
        {
          title: "备注",
          dataIndex: "classificationRemake",
          langCode: "remarks",
        },
        {
          title: "操作",
          width: 100,
          align: "center",
          dataIndex: "action",
          scopedSlots: { customRender: "renderAction" },
        },
      ],
      visible: false,
      confirmLoading: false,
      mdl: null,
      // 查询参数
      queryParam: {},
      url: {
        getPageSet: "/system/sysInterfaceClassification/getPageSet",
        save: "/system/sysInterfaceClassification/save",
        update: "/system/sysInterfaceClassification/update",
        deleteBatch: "/system/sysInterfaceClassification/deleteBatch",
      },
      key: "1",
    };
  },

  methods: {},
};
</script>

<style scoped lang="less">
.table {
  background-color: @base-bg-color;
  padding: 24px;
}
</style>
